#include "gdn/Text.h"

#include <iostream>

#include "gdn/Utility.h"

namespace gdn
{
	Text::Text()
	   : text(),
	     font( NULL )
	{
	}

	void Text::SetString( const std::string& theString )
	{
		text.SetString( theString );
	}

	std::string Text::GetString() const
	{
		return text.GetString().ToAnsiString();
	}

	void Text::SetFont( const Font& theFont )
	{
		text.SetFont( theFont.font );
		font = &theFont;
		//std::cout << "font set" << std::endl;
	}

	const Font& Text::GetFont() const
	{
		return ( * font );
	}

	void Text::SetColor( const Color& theColor )
	{
		//std::cout << static_cast< unsigned int >( ConvertFromGdn( theColor ).r ) << "." << theColor.r << std::endl;
		text.SetColor( ConvertFromGdn( theColor ) );
	}

	Color Text::GetColor() const
	{
		return ConvertToGdn( text.GetColor() );
	}

	void Text::SetCharacterSize( unsigned int theSize )
	{
		text.SetCharacterSize( theSize );
	}

	unsigned int Text::SetCharacterSize() const
	{
		return text.GetCharacterSize();
	}

	Rectanglef Text::GetRectangle() const
	{
		return ConvertToGdn< float >( text.GetRect() );
	}

	void Text::SetPosition( float theX, float theY )
	{
		text.SetPosition( theX, theY );
	}

	void Text::SetPosition( const Vector2f& thePos )
	{
		SetPosition( thePos.x, thePos.y );
	}

	Vector2f Text::GetPosition() const
	{
		return ConvertToGdn< float >( text.GetPosition() );
	}

	void Text::SetRotation( float degrees )
	{
		text.SetRotation( degrees );
	}

	float Text::GetRotation() const
	{
		return text.GetRotation();
	}

	void Text::SetScale( float theX, float theY )
	{
		text.SetScale( theX, theY );
	}

	void Text::SetScale( const Vector2f& theScale )
	{
		SetScale( theScale.x, theScale.y );
	}

	Vector2f Text::GetScale() const
	{
		return ConvertToGdn< float >( text.GetScale() );
	}

	void Text::SetOrigin( float theX, float theY )
	{
		text.SetOrigin( theX, theY );
	}

	void Text::SetOrigin( const Vector2f& theOrigin )
	{
		SetOrigin( theOrigin.x, theOrigin.y );
	}

	Vector2f Text::GetOrigin() const
	{
		return ConvertToGdn< float >( text.GetOrigin() );
	}
}
